Deriving context for last position coding for video coding

ABSTRACT

In one example, a device includes a video coder configured to determine a context for entropy coding a bin of a value indicative of a last significant coefficient of a block of video data using a function of an index of the bin, and code the bin using the determined context. The video coder may encode or decode the bin using context-adaptive binary arithmetic coding (CABAC). The function may also depend on a size of the block. In this manner, a table indicating context indexes for the contexts need not be stored by the device.

This application claims the benefit of U.S. Provisional Application Ser.Nos. 61/614,178, filed Mar. 22, 2012, 61/620,273, filed Apr. 4, 2012,and 61/666,316 filed Jun. 29, 2012, the entire contents of each of whichare hereby incorporated by reference.

TECHNICAL FIELD

This disclosure relates to video coding.

BACKGROUND

Digital video capabilities can be incorporated into a wide range ofdevices, including digital televisions, digital direct broadcastsystems, wireless broadcast systems, personal digital assistants (PDAs),laptop or desktop computers, tablet computers, e-book readers, digitalcameras, digital recording devices, digital media players, video gamingdevices, video game consoles, cellular or satellite radio telephones,so-called “smart phones,” video teleconferencing devices, videostreaming devices, and the like. Digital video devices implement videocoding techniques, such as those described in the standards defined byMPEG-2, MPEG-4, ITU-T H.263, ITU-T H.264/MPEG-4, Part 10, Advanced VideoCoding (AVC), the High Efficiency Video Coding (HEVC) standard presentlyunder development, and extensions of such standards. The video devicesmay transmit, receive, encode, decode, and/or store digital videoinformation more efficiently by implementing such video codingtechniques.

Video coding techniques include spatial (intra-picture) predictionand/or temporal (inter-picture) prediction to reduce or removeredundancy inherent in video sequences. For block-based video coding, avideo slice (e.g., a video frame or a portion of a video frame) may bepartitioned into video blocks, which may also be referred to astreeblocks, coding units (CUs) and/or coding nodes. Video blocks in anintra-coded (I) slice of a picture are encoded using spatial predictionwith respect to reference samples in neighboring blocks in the samepicture. Video blocks in an inter-coded (P or B) slice of a picture mayuse spatial prediction with respect to reference samples in neighboringblocks in the same picture or temporal prediction with respect toreference samples in other reference pictures. Pictures may be referredto as frames, and reference pictures may be referred to a referenceframes.

Spatial or temporal prediction results in a predictive block for a blockto be coded. Residual data represents pixel differences between theoriginal block to be coded and the predictive block. An inter-codedblock is encoded according to a motion vector that points to a block ofreference samples forming the predictive block, and the residual dataindicating the difference between the coded block and the predictiveblock. An intra-coded block is encoded according to an intra-coding modeand the residual data. For further compression, the residual data may betransformed from the pixel domain to a transform domain, resulting inresidual transform coefficients, which then may be quantized. Thequantized transform coefficients, initially arranged in atwo-dimensional array, may be scanned in order to produce aone-dimensional vector of transform coefficients, and entropy coding maybe applied to achieve even more compression.

SUMMARY

In general, this disclosure describes techniques for coding syntaxelements associated with video data using one or more functions. Forinstance, a device may implement one or more of the techniques to code avalue indicating a position of a last significant coefficient of a blockof video data (such as a transform unit, or “TU”). To code the value,the device may use a function of an index of each bit (or “bin”) in abinarized value corresponding to the last significant coefficient, wherethe index indicates a position of the bin in an array of binsrepresenting the binarized value.

In one example, a method includes determining a context for entropycoding a bin of a value indicative of a last significant coefficient ofa block of video data using a function of an index of the bin, andcoding the bin using the determined context.

In another example, a device for coding video data includes a videocoder configured to determine a context for entropy coding a bin of avalue indicative of a last significant coefficient of a block of videodata using a function of an index of the bin, and code the bin using thedetermined context.

In another example, a device includes means for determining a contextfor entropy coding a bin of a value indicative of a last significantcoefficient of a block of video data using a function of an index of thebin, and means for coding the bin using the determined context.

In another example, a computer-readable storage medium is encoded withinstructions. When executed, the instructions cause a programmableprocessor of a computing device to determine a context for entropycoding a bin of a value indicative of a last significant coefficient ofa block of video data using a function of an index of the bin, and codethe bin using the determined context.

The details of one or more examples are set forth in the accompanyingdrawings and the description below. Other features, objects, andadvantages will be apparent from the description and drawings, and fromthe claims.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating an example video encoding anddecoding system that may utilize techniques for determining a context touse to code a value representing a last significant coefficient of ablock of video data.

FIG. 2 is a block diagram illustrating an example of a video encoderthat may implement techniques for determining a context to use to code avalue representing a last significant coefficient of a block of videodata.

FIG. 3 is a block diagram illustrating an example of a video decoderthat may implement techniques for determining a context to use to code avalue representing a last significant coefficient of a block of videodata.

FIG. 4 is a flowchart illustrating an example method for encoding acurrent block of video data.

FIG. 5 is a flowchart illustrating an example method for decoding acurrent block of video data.

DETAILED DESCRIPTION

In general, the techniques of this disclosure relate to video coding. Invideo coding, a sequence of pictures are individually coded using eitherspatial prediction (intra-prediction) or temporal prediction(inter-prediction). In particular, video coders code individual blocksof the pictures using intra- or inter-prediction. Video coders also coderesidual data for the blocks, where the residual data generallycorresponds to residual blocks, which represent pixel-by-pixeldifferences between the predicted data and the raw, uncoded data. Videocoders may transform and quantize the residual data to produce quantizedtransform coefficients for the residual blocks. Video coders furthercode syntax data such as whether the coefficients are significant (e.g.,have absolute values greater than zero), locations of significantcoefficients, a location of a last significant coefficient in scanorder, and level values for the significant coefficients.

This disclosure describes techniques for coding a value indicative of alast significant coefficient in a block of video data, such as atransform unit (TU). In particular, to code syntax elements, such as thevalue indicative of the last significant coefficient in the block, videocoders may be configured to apply context-adaptive binary arithmeticcoding (CABAC). CABAC coding involves the use of various contexts,indicated by context indexes, which generally indicate the likelihoodthat an individual bit (or “bin”) of a binarized string will have aparticular value (e.g., 0 or 1). Specifically, the context for coding abin of a value indicative of a last significant coefficient in a blockis determined individually for each bin of the value, that is, based ona location of the bin in the value (e.g., an index of the bin, assumingthe value is represented as an array of bins).

Rather than using a mapping table, which provides indications of thecontext indexes for contexts to use to code particular bins, thetechniques of this disclosure include using a function to determine thecontext index of a context to use to code a bin. In particular, thefunction may be a function of an index of the bin. For example, assumingthat the bin is the i^(th) bin of a value being coded, a function may bedefined as f(i), where f(i) returns a context index value correspondingto a context to use to code bin i of a binarized value. The context, asdescribed above, may indicate the likelihood that bin i will have aparticular value, e.g., 0 or 1.

In this manner, this disclosure describes techniques of CABAC coding oflast significant coefficient position (last position). For a lastposition bin to be encoded, the index of its CABAC context may bederived using a function, such that a mapping table between lastposition bins and CABAC contexts can be saved (e.g., not stored). CABACcoding generally includes two parts: binarization and CABAC coding. Thebinarization process is performed to convert the location of the lastsignificant coefficient of a block to a binary string, e.g., an array ofbins. The binarization method used in the High Efficiency Video CodingTest Model (HM) is truncated unary+fixed length encoding. For thetruncated unary code part, the bins are encoded using CABAC contexts.For the fixed length part, the bins are encoded using bypass mode(without contexts). An example of 32×32 TU (transform unit/transformblock) is shown in Table 1 below:

TABLE 1 Fixed Magnitude of last Truncated unary binary positioncomponent (context model) (bypass) f_value 0 1 — 0 1 01 — 0 2 001 — 0 30001 — 0 4-5 00001 X 0-1 6-7 000001 X 0-1  8-11 0000001 XX 0-3 12-1500000001 XX 0-3 16-23 000000001 XXX 0-7 24-31 000000000 XXX 0-7

Table 2 below illustrates an example context mapping table used inconventional HM. Table 2 shows that last positions at differentlocations can share the same contexts. For some bins, for example, bins6-7 of an 8×8 block, there is no context assigned, that is because theyare encoded without context (bypass mode), as shown in Table 1 above.

TABLE 2 Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 1 2 TU 8 × 8 3 4 5 5 2TU 16 × 16 6 7 8 8 9 9 2 TU 32 × 32 10 11 12 14 13 13 14 14 2

Although conventional HM uses a table such as Table 2 to determinecontexts for coding bins of a last position value (that is, a valueindicating a last significant coefficient position in a block of videodata), the techniques of this disclosure include the use of a functionto determine the contexts for coding bins of the last position value.Thus, a table similar to Table 2 need not be in a video coder configuredaccording to the techniques of this disclosure. In this manner, afunction may be used to derive the CABAC context index for the bins inlast position coding, such that the mapping table (Table 2) can beremoved. Various examples of coding devices configured to executefunctions to determine contexts for coding bins of syntax elements aredescribed in greater detail below.

FIG. 1 is a block diagram illustrating an example video encoding anddecoding system 10 that may utilize techniques for determining a contextto use to code a value representing a last significant coefficient of ablock of video data. As shown in FIG. 1, system 10 includes a sourcedevice 12 that provides encoded video data to be decoded at a later timeby a destination device 14. In particular, source device 12 provides thevideo data to destination device 14 via a computer-readable medium 16.Source device 12 and destination device 14 may comprise any of a widerange of devices, including desktop computers, notebook (i.e., laptop)computers, tablet computers, set-top boxes, telephone handsets such asso-called “smart” phones, so-called “smart” pads, televisions, cameras,display devices, digital media players, video gaming consoles, videostreaming device, or the like. In some cases, source device 12 anddestination device 14 may be equipped for wireless communication.

Destination device 14 may receive the encoded video data to be decodedvia computer-readable medium 16. Computer-readable medium 16 maycomprise any type of medium or device capable of moving the encodedvideo data from source device 12 to destination device 14. In oneexample, computer-readable medium 16 may comprise a communication mediumto enable source device 12 to transmit encoded video data directly todestination device 14 in real-time. The encoded video data may bemodulated according to a communication standard, such as a wirelesscommunication protocol, and transmitted to destination device 14. Thecommunication medium may comprise any wireless or wired communicationmedium, such as a radio frequency (RF) spectrum or one or more physicaltransmission lines. The communication medium may form part of apacket-based network, such as a local area network, a wide-area network,or a global network such as the Internet. The communication medium mayinclude routers, switches, base stations, or any other equipment thatmay be useful to facilitate communication from source device 12 todestination device 14.

In some examples, encoded data may be output from output interface 22 toa storage device. Similarly, encoded data may be accessed from thestorage device by input interface. The storage device may include any ofa variety of distributed or locally accessed data storage media such asa hard drive, Blu-ray discs, DVDs, CD-ROMs, flash memory, volatile ornon-volatile memory, or any other suitable digital storage media forstoring encoded video data. In a further example, the storage device maycorrespond to a file server or another intermediate storage device thatmay store the encoded video generated by source device 12. Destinationdevice 14 may access stored video data from the storage device viastreaming or download. The file server may be any type of server capableof storing encoded video data and transmitting that encoded video datato the destination device 14. Example file servers include a web server(e.g., for a website), an FTP server, network attached storage (NAS)devices, or a local disk drive. Destination device 14 may access theencoded video data through any standard data connection, including anInternet connection. This may include a wireless channel (e.g., a Wi-Ficonnection), a wired connection (e.g., DSL, cable modem, etc.), or acombination of both that is suitable for accessing encoded video datastored on a file server. The transmission of encoded video data from thestorage device may be a streaming transmission, a download transmission,or a combination thereof.

The techniques of this disclosure are not necessarily limited towireless applications or settings. The techniques may be applied tovideo coding in support of any of a variety of multimedia applications,such as over-the-air television broadcasts, cable televisiontransmissions, satellite television transmissions, Internet streamingvideo transmissions, such as dynamic adaptive streaming over HTTP(DASH), digital video that is encoded onto a data storage medium,decoding of digital video stored on a data storage medium, or otherapplications. In some examples, system 10 may be configured to supportone-way or two-way video transmission to support applications such asvideo streaming, video playback, video broadcasting, and/or videotelephony.

In the example of FIG. 1, source device 12 includes video source 18,video encoder 20, and output interface 22. Destination device 14includes input interface 28, video decoder 30, and display device 32. Inaccordance with this disclosure, video encoder 20 of source device 12may be configured to apply the techniques for determining a context touse to code a value representing a last significant coefficient of ablock of video data. In other examples, a source device and adestination device may include other components or arrangements. Forexample, source device 12 may receive video data from an external videosource 18, such as an external camera. Likewise, destination device 14may interface with an external display device, rather than including anintegrated display device.

The illustrated system 10 of FIG. 1 is merely one example. Techniquesfor determining a context to use to code a value representing a lastsignificant coefficient of a block of video data may be performed by anydigital video encoding and/or decoding device. Although generally thetechniques of this disclosure are performed by a video encoding device,the techniques may also be performed by a video encoder/decoder,typically referred to as a “CODEC.” Moreover, the techniques of thisdisclosure may also be performed by a video preprocessor. Source device12 and destination device 14 are merely examples of such coding devicesin which source device 12 generates coded video data for transmission todestination device 14. In some examples, devices 12, 14 may operate in asubstantially symmetrical manner such that each of devices 12, 14include video encoding and decoding components. Hence, system 10 maysupport one-way or two-way video transmission between video devices 12,14, e.g., for video streaming, video playback, video broadcasting, orvideo telephony.

Video source 18 of source device 12 may include a video capture device,such as a video camera, a video archive containing previously capturedvideo, and/or a video feed interface to receive video from a videocontent provider. As a further alternative, video source 18 may generatecomputer graphics-based data as the source video, or a combination oflive video, archived video, and computer-generated video. In some cases,if video source 18 is a video camera, source device 12 and destinationdevice 14 may form so-called camera phones or video phones. As mentionedabove, however, the techniques described in this disclosure may beapplicable to video coding in general, and may be applied to wirelessand/or wired applications. In each case, the captured, pre-captured, orcomputer-generated video may be encoded by video encoder 20. The encodedvideo information may then be output by output interface 22 onto acomputer-readable medium 16.

Computer-readable medium 16 may include transient media, such as awireless broadcast or wired network transmission, or storage media (thatis, non-transitory storage media), such as a hard disk, flash drive,compact disc, digital video disc, Blu-ray disc, or othercomputer-readable media. In some examples, a network server (not shown)may receive encoded video data from source device 12 and provide theencoded video data to destination device 14, e.g., via networktransmission. Similarly, a computing device of a medium productionfacility, such as a disc stamping facility, may receive encoded videodata from source device 12 and produce a disc containing the encodedvideo data. Therefore, computer-readable medium 16 may be understood toinclude one or more computer-readable media of various forms, in variousexamples.

Input interface 28 of destination device 14 receives information fromcomputer-readable medium 16. The information of computer-readable medium16 may include syntax information defined by video encoder 20, which isalso used by video decoder 30, that includes syntax elements thatdescribe characteristics and/or processing of blocks and other codedunits, e.g., GOPs. Display device 32 displays the decoded video data toa user, and may comprise any of a variety of display devices such as acathode ray tube (CRT), a liquid crystal display (LCD), a plasmadisplay, an organic light emitting diode (OLED) display, or another typeof display device.

Video encoder 20 and video decoder 30 may operate according to a videocoding standard, such as the High Efficiency Video Coding (HEVC)standard presently under development, and may conform to the HEVC TestModel (HM). Alternatively, video encoder 20 and video decoder 30 mayoperate according to other proprietary or industry standards, such asthe ITU-T H.264 standard, alternatively referred to as MPEG-4, Part 10,Advanced Video Coding (AVC), or extensions of such standards. Thetechniques of this disclosure, however, are not limited to anyparticular coding standard. Other examples of video coding standardsinclude MPEG-2 and ITU-T H.263. Although not shown in FIG. 1, in someaspects, video encoder 20 and video decoder 30 may each be integratedwith an audio encoder and decoder, and may include appropriate MUX-DEMUXunits, or other hardware and software, to handle encoding of both audioand video in a common data stream or separate data streams. Ifapplicable, MUX-DEMUX units may conform to the ITU H.223 multiplexerprotocol, or other protocols such as the user datagram protocol (UDP).

The ITU-T H.264/MPEG-4 (AVC) standard was formulated by the ITU-T VideoCoding Experts Group (VCEG) together with the ISO/IEC Moving PictureExperts Group (MPEG) as the product of a collective partnership known asthe Joint Video Team (JVT). In some aspects, the techniques described inthis disclosure may be applied to devices that generally conform to theH.264 standard. The H.264 standard is described in ITU-T RecommendationH.264, Advanced Video Coding for generic audiovisual services, by theITU-T Study Group, and dated March, 2005, which may be referred toherein as the H.264 standard or H.264 specification, or the H.264/AVCstandard or specification. The Joint Video Team (JVT) continues to workon extensions to H.264/MPEG-4 AVC.

Video encoder 20 and video decoder 30 each may be implemented as any ofa variety of suitable encoder circuitry, such as one or moremicroprocessors, digital signal processors (DSPs), application specificintegrated circuits (ASICs), field programmable gate arrays (FPGAs),discrete logic, software, hardware, firmware or any combinationsthereof. When the techniques are implemented partially in software, adevice may store instructions for the software in a suitable,non-transitory computer-readable medium and execute the instructions inhardware using one or more processors to perform the techniques of thisdisclosure. Each of video encoder 20 and video decoder 30 may beincluded in one or more encoders or decoders, either of which may beintegrated as part of a combined encoder/decoder (CODEC) in a respectivedevice.

The JCT-VC is working on development of the HEVC standard. The HEVCstandardization efforts are based on an evolving model of a video codingdevice referred to as the HEVC Test Model (HM). The HM presumes severaladditional capabilities of video coding devices relative to existingdevices according to, e.g., ITU-T H.264/AVC. For example, whereas H.264provides nine intra-prediction encoding modes, the HM may provide asmany as thirty-three intra-prediction encoding modes.

In general, the working model of the HM describes that a video frame orpicture may be divided into a sequence of treeblocks or largest codingunits (LCU) that include both luma and chroma samples. Syntax datawithin a bitstream may define a size for the LCU, which is a largestcoding unit in terms of the number of pixels. A slice includes a numberof consecutive treeblocks in coding order. A video frame or picture maybe partitioned into one or more slices. Each treeblock may be split intocoding units (CUs) according to a quadtree. In general, a quadtree datastructure includes one node per CU, with a root node corresponding tothe treeblock. If a CU is split into four sub-CUs, the nodecorresponding to the CU includes four leaf nodes, each of whichcorresponds to one of the sub-CUs.

Each node of the quadtree data structure may provide syntax data for thecorresponding CU. For example, a node in the quadtree may include asplit flag, indicating whether the CU corresponding to the node is splitinto sub-CUs. Syntax elements for a CU may be defined recursively, andmay depend on whether the CU is split into sub-CUs. If a CU is not splitfurther, it is referred as a leaf-CU. In this disclosure, four sub-CUsof a leaf-CU will also be referred to as leaf-CUs even if there is noexplicit splitting of the original leaf-CU. For example, if a CU at16×16 size is not split further, the four 8×8 sub-CUs will also bereferred to as leaf-CUs although the 16×16 CU was never split.

A CU has a similar purpose as a macroblock of the H.264 standard, exceptthat a CU does not have a size distinction. For example, a treeblock maybe split into four child nodes (also referred to as sub-CUs), and eachchild node may in turn be a parent node and be split into another fourchild nodes. A final, unsplit child node, referred to as a leaf node ofthe quadtree, comprises a coding node, also referred to as a leaf-CU.Syntax data associated with a coded bitstream may define a maximumnumber of times a treeblock may be split, referred to as a maximum CUdepth, and may also define a minimum size of the coding nodes.Accordingly, a bitstream may also define a smallest coding unit (SCU).This disclosure uses the term “block” to refer to any of a CU, PU, orTU, in the context of HEVC, or similar data structures in the context ofother standards (e.g., macroblocks and sub-blocks thereof in H.264/AVC).

A CU includes a coding node and prediction units (PUs) and transformunits (TUs) associated with the coding node. A size of the CUcorresponds to a size of the coding node and must be square in shape.The size of the CU may range from 8×8 pixels up to the size of thetreeblock with a maximum of 64×64 pixels or greater. Each CU may containone or more PUs and one or more TUs. Syntax data associated with a CUmay describe, for example, partitioning of the CU into one or more PUs.Partitioning modes may differ between whether the CU is skip or directmode encoded, intra-prediction mode encoded, or inter-prediction modeencoded. PUs may be partitioned to be non-square in shape. Syntax dataassociated with a CU may also describe, for example, partitioning of theCU into one or more TUs according to a quadtree. A TU can be square ornon-square (e.g., rectangular) in shape.

The HEVC standard allows for transformations according to TUs, which maybe different for different CUs. The TUs are typically sized based on thesize of PUs within a given CU defined for a partitioned LCU, althoughthis may not always be the case. The TUs are typically the same size orsmaller than the PUs. In some examples, residual samples correspondingto a CU may be subdivided into smaller units using a quadtree structureknown as “residual quad tree” (RQT). The leaf nodes of the RQT may bereferred to as transform units (TUs). Pixel difference values associatedwith the TUs may be transformed to produce transform coefficients, whichmay be quantized.

A leaf-CU may include one or more prediction units (PUs). In general, aPU represents a spatial area corresponding to all or a portion of thecorresponding CU, and may include data for retrieving a reference samplefor the PU. Moreover, a PU includes data related to prediction. Forexample, when the PU is intra-mode encoded, data for the PU may beincluded in a residual quadtree (RQT), which may include data describingan intra-prediction mode for a TU corresponding to the PU. As anotherexample, when the PU is inter-mode encoded, the PU may include datadefining one or more motion vectors for the PU. The data defining themotion vector for a PU may describe, for example, a horizontal componentof the motion vector, a vertical component of the motion vector, aresolution for the motion vector (e.g., one-quarter pixel precision orone-eighth pixel precision), a reference picture to which the motionvector points, and/or a reference picture list (e.g., List 0, List 1, orList C) for the motion vector.

A leaf-CU having one or more PUs may also include one or more transformunits (TUs). The transform units may be specified using an RQT (alsoreferred to as a TU quadtree structure), as discussed above. Forexample, a split flag may indicate whether a leaf-CU is split into fourtransform units. Then, each transform unit may be split further intofurther sub-TUs. When a TU is not split further, it may be referred toas a leaf-TU. Generally, for intra coding, all the leaf-TUs belonging toa leaf-CU share the same intra prediction mode. That is, the sameintra-prediction mode is generally applied to calculate predicted valuesfor all TUs of a leaf-CU. For intra coding, a video encoder maycalculate a residual value for each leaf-TU using the intra predictionmode, as a difference between the portion of the CU corresponding to theTU and the original block. A TU is not necessarily limited to the sizeof a PU. Thus, TUs may be larger or smaller than a PU. For intra coding,a PU may be collocated with a corresponding leaf-TU for the same CU. Insome examples, the maximum size of a leaf-TU may correspond to the sizeof the corresponding leaf-CU.

Moreover, TUs of leaf-CUs may also be associated with respectivequadtree data structures, referred to as residual quadtrees (RQTs). Thatis, a leaf-CU may include a quadtree indicating how the leaf-CU ispartitioned into TUs. The root node of a TU quadtree generallycorresponds to a leaf-CU, while the root node of a CU quadtree generallycorresponds to a treeblock (or LCU). TUs of the RQT that are not splitare referred to as leaf-TUs. In general, this disclosure uses the termsCU and TU to refer to leaf-CU and leaf-TU, respectively, unless notedotherwise.

A video sequence typically includes a series of video frames orpictures. A group of pictures (GOP) generally comprises a series of oneor more of the video pictures. A GOP may include syntax data in a headerof the GOP, a header of one or more of the pictures, or elsewhere, thatdescribes a number of pictures included in the GOP. Each slice of apicture may include slice syntax data that describes an encoding modefor the respective slice. Video encoder 20 typically operates on videoblocks within individual video slices in order to encode the video data.A video block may correspond to a coding node within a CU. The videoblocks may have fixed or varying sizes, and may differ in size accordingto a specified coding standard.

As an example, the HM supports prediction in various PU sizes. Assumingthat the size of a particular CU is 2N×2N, the HM supportsintra-prediction in PU sizes of 2N×2N or N×N, and inter-prediction insymmetric PU sizes of 2N×2N, 2N×N, N×2N, or N×N. The HM also supportsasymmetric partitioning for inter-prediction in PU sizes of 2N×nU,2N×nD, nL×2N, and nR×2N. In asymmetric partitioning, one direction of aCU is not partitioned, while the other direction is partitioned into 25%and 75%. The portion of the CU corresponding to the 25% partition isindicated by an “n” followed by an indication of “Up”, “Down,” “Left,”or “Right.” Thus, for example, “2N×nU” refers to a 2N×2N CU that ispartitioned horizontally with a 2N×0.5N PU on top and a 2N×1.5N PU onbottom.

In this disclosure, “N×N” and “N by N” may be used interchangeably torefer to the pixel dimensions of a video block in terms of vertical andhorizontal dimensions, e.g., 16×16 pixels or 16 by 16 pixels. Ingeneral, a 16×16 block will have 16 pixels in a vertical direction(y=16) and 16 pixels in a horizontal direction (x=16). Likewise, an N×Nblock generally has N pixels in a vertical direction and N pixels in ahorizontal direction, where N represents a nonnegative integer value.The pixels in a block may be arranged in rows and columns. Moreover,blocks need not necessarily have the same number of pixels in thehorizontal direction as in the vertical direction. For example, blocksmay comprise N×M pixels, where M is not necessarily equal to N.

Following intra-predictive or inter-predictive coding using the PUs of aCU, video encoder 20 may calculate residual data for the TUs of the CU.The PUs may comprise syntax data describing a method or mode ofgenerating predictive pixel data in the spatial domain (also referred toas the pixel domain) and the TUs may comprise coefficients in thetransform domain following application of a transform, e.g., a discretecosine transform (DCT), an integer transform, a wavelet transform, or aconceptually similar transform to residual video data. The residual datamay correspond to pixel differences between pixels of the unencodedpicture and prediction values corresponding to the PUs. Video encoder 20may form the TUs including the residual data for the CU, and thentransform the TUs to produce transform coefficients for the CU.

Following any transforms to produce transform coefficients, videoencoder 20 may perform quantization of the transform coefficients.Quantization generally refers to a process in which transformcoefficients are quantized to possibly reduce the amount of data used torepresent the coefficients, providing further compression. Thequantization process may reduce the bit depth associated with some orall of the coefficients. For example, an n-bit value may be rounded downto an m-bit value during quantization, where n is greater than m.

Following quantization, the video encoder may scan the transformcoefficients, producing a one-dimensional vector from thetwo-dimensional matrix including the quantized transform coefficients.The scan may be designed to place higher energy (and therefore lowerfrequency) coefficients at the front of the array and to place lowerenergy (and therefore higher frequency) coefficients at the back of thearray. In some examples, video encoder 20 may utilize a predefined scanorder to scan the quantized transform coefficients to produce aserialized vector that can be entropy encoded. In other examples, videoencoder 20 may perform an adaptive scan. After scanning the quantizedtransform coefficients to form a one-dimensional vector, video encoder20 may entropy encode the one-dimensional vector, e.g., according tocontext-adaptive variable length coding (CAVLC), context-adaptive binaryarithmetic coding (CABAC), syntax-based context-adaptive binaryarithmetic coding (SBAC), Probability Interval Partitioning Entropy(PIPE) coding or another entropy encoding methodology. Video encoder 20may also entropy encode syntax elements associated with the encodedvideo data for use by video decoder 30 in decoding the video data.

To perform CABAC, video encoder 20 may assign a context within a contextmodel to a symbol to be transmitted. The context may relate to, forexample, whether neighboring values of the symbol are non-zero or not.To perform CAVLC, video encoder 20 may select a variable length code fora symbol to be transmitted. Codewords in VLC may be constructed suchthat relatively shorter codes correspond to more probable symbols, whilelonger codes correspond to less probable symbols. In this way, the useof VLC may achieve a bit savings over, for example, using equal-lengthcodewords for each symbol to be transmitted. The probabilitydetermination may be based on a context assigned to the symbol.

In accordance with the techniques of this disclosure, video encoder 20may encode a value representing a position of a last significantcoefficient of a block of video data using contexts determined using oneor more functions of bins of the value. Likewise, video decoder 30 maydecode a value representing a last significant coefficient of a block ofvideo data using contexts determined using one or more functions of binsof the value. Video encoder 20 and/or video decoder 30 may be configuredto perform any of functions (1)-(12), described in greater detail below,or conceptually similar functions, to perform the techniques of thisdisclosure. In this manner, video encoder 20 and video decoder 30represent examples of video coders configured to determine a context forentropy coding a bin of a value indicative of a last significantcoefficient of a block of video data using a function of an index of thebin, and code the bin using the determined context.

As an example, “Ctx_i” may denote the index of the context used by videoencoder 20 to encode the i^(th) bin in the “last position” binarystring. Video encoder 20 may derive Ctx_i using the following equation:Ctx _(—) i=f(i).

The function denoted by f(i) may be linear or non-linear. Additionally,f(i) may be a predefined function that is accessible to both videoencoder 20 and video decoder 30. Alternatively, f(i) may be selected bya user or by video encoder 20, and transmitted to video decoder 30 usingone or more types of high-level syntax signaling, such as a sequenceparameter set (SPS), a picture parameter set (PPS), an adaptationparameter set (APS), a frame header, a slice header, a sequence header,or other such syntax signaling. An example of one such function thatvideo encoder 20 may execute is:f(i)=(i>>1),  (1)where “>>” denotes the binary right-shift operator. In turn, the resultof f(i) may correspond to Ctx_i. That is, video encoder 20 may executef(i) to generate an output equal to the value of Ctx_i. Morespecifically, video encoder 20 may execute f(i) to generate the contextindex of a context to be used to entropy code the i^(th) bin.

Table 3 below illustrates an example of the context indexes that videoencoder 20 may use to code bins at various bin indexes for various block(e.g., TU) sizes using the example function (1) described above.Although Table 3 is provided for purposes of explanation of the resultsof example function (1), it will be appreciated that a table such asTable 3 need not be stored in a video coding device such as sourcedevice 12 and/or destination device 14. Instead, one or both of videoencoder 20 and video decoder 30 may execute function (1) above toproduce the results indicated in Table 3, based on various bin indexes.

TABLE 3 Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 0 1 TU 8 × 8 0 0 1 1 2TU 16 × 16 0 0 1 1 2 2 3 TU 32 × 32 0 0 1 1 2 2 3 3 4

As another example, video encoder 20 may execute a function that isdependent on both the bin index (i) and a size of a corresponding block(e.g., a TU). The corresponding block may be the block that includes thecoefficients described by the last significant coefficient value. As anexample, the context index may be produced by a function, such as:

-   -   Ctx_i=f(i, TUBlkSize), where “TUBlkSize” is a value indicative        of the block size. For purposes of this disclosure, the terms        “TUBlkSize” and “block_size” may be used interchangeably to        indicate the block size.        As one example, the function may be:        f(i,TUBlkSize)=i>>(log₂(TUBlkSize)−2).  (2)

Table 4 below illustrates an example of the context indexes that videoencoder 20 would use to code bins at various bin indexes for variousblock (e.g., TU) sizes using the example function (2). Although Table 4is provided for purposes of explanation of the results of examplefunction (2), it will be appreciated that a table such as Table 4 neednot be stored in a video coding device such as source device 12 and/ordestination device 14. Instead, one or both of video encoder 20 andvideo decoder 30 may execute example function (2) described above toproduce the results indicated in Table 4.

TABLE 4 Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 1 2 TU 8 × 8 0 0 1 1 2TU 16 × 16 0 0 0 0 1 1 1 TU 32 × 32 0 0 0 0 0 0 0 0 1

As another example, video encoder 20 may execute the following functionto derive Ctx_i:f(i,TUBlkSize)=i>>1+TUSIZEoffset, whereTUSIZEoffset=(log₂(TUBlkSize)−2)*(log₂(TUBlkSize)+1)/2.  (3)

Table 5 below illustrates an example of the context indexes that videoencoder 20 may use to code bins at various bin indexes for various block(e.g., TU) sizes using the example function (3). Although Table 5 isprovided for purposes of explanation of the results of example function(3), it will be appreciated that a table such as Table 5 need not bestored source device 12 and/or destination device 14. Instead, one orboth of video encoder 20 and video decoder 30 may execute examplefunction (3) described above to produce the results indicated in Table5.

TABLE 5 Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 0 1 TU 8 × 8 2 2 3 3 4TU 16 × 16 5 5 6 6 7 7 8 TU 32 × 32 9 9 10 10 11 11 12 12 13

As still another example, video encoder 20 may execute the followingfunction to derive Ctx_i:Ctx _(—) idx=(i+1)>>1+TUSIZEoffset, whereTUSIZEoffset=(log₂(TUBlkSize)−2)*(log₂(TUBlkSize)+1)/2.  (4)

Table 6 below illustrates an example of the context indexes that videoencoder 20 may use to code bins at various bin indexes for various block(e.g., TU) sizes using the example function (4). Although Table 6 isprovided for purposes of explanation of the results of the function, itwill be appreciated that a table such as Table 6 need not be stored in avideo coding device such as source device 12 and/or destination device14. Instead, one or both of video encoder 20 and video decoder 30 mayexecute example function (4) described above to produce the resultsindicated in Table 6.

TABLE 6 Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 1 1 TU 8 × 8 2 3 3 4 4TU 16 × 16 5 6 6 7 7 8 8 TU 32 × 32 9 10 10 11 11 12 12 13 13

As another example, the function may be:Ctx _(—) idx=offset+(i>>k),  (5)where:offset=3*n+((n+1)>>2),  (6)k=(n+3)>>2, and  (7)n=(log₂(TUBlkSize)−2).  (8)Alternatively, example function (8) may be expressed as:n=(log₂(block_size)−2) for purposes of this disclosure.

Table 7 below illustrates an example of the context indexes that videoencoder 20 may use to code bins at various bin indexes for various block(e.g., TU) sizes using the example functions (5)-(8). Although Table 7is provided for purposes of explanation of the results of the functions,it will be appreciated that a table such as Table 7 need not be storedin a video coding device such as source device 12 and/or destinationdevice 14. Instead, one or both of video encoder 20 and video decoder 30may execute example functions (5)-(8) above to produce the resultsindicated in Table 7.

TABLE 7 Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 1 2 TU 8 × 8 3 3 4 4 5TU 16 × 16 6 6 7 7 8 8 9 TU 32 × 32 10 10 11 11 12 12 13 13 14

Tables 8 and 9 below illustrate another example in which video encoder20 and/or video decoder 30 may apply one or more formula-based contextderivation techniques of this disclosure for bins in “last position”coding to luma and chroma components in a unified manner. In particular,Table 8 illustrates bin indexes for luma TUs of various sizes, whileTable 9 provides bin indexes for chroma TUs of various sizes.

TABLE 8 Luma Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 1 2 TU 8 × 8 3 3 44 5 TU 16 × 16 6 6 7 7 8 8 9 TU 32 × 32 10 10 11 11 12 12 13 13 14

TABLE 9 Chroma Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 1 2 TU 8 × 8 0 01 1 2 TU 16 × 16 0 0 1 1 2 2 3

One example of a function that video encoder 20 and/or video decoder 30may use for deriving contexts for bins in last position coding of lumaTUs, per table 8, and chroma TUs, per table 9, is:Ctx _(—) idx=offset+(i>>k),  (9)

-   -   where Luma and Chroma share the same value of k, k=(n+3)>>2 with        n=(log₂(TUBlkSize)−2)

Video encoder 20 and/or video decoder 30 may determine the values forthe variable “offset” of function (9), based on whether the TU is a lumaTU or a chroma TU using various functions. Examples of such functionsinclude the following:Luma:offset=3*n+((n+1)>>2)  (10)Chroma:offset=0  (11)

In this manner, function (9) represents an example of a function thatvideo encoder 20 and/or video decoder 30 may execute to produce acontext index. In turn, the context index may be indicative of a contextfor coding a bin of a value indicative of a last significant coefficientof a block of video data as a function of an index of the bin (i) and avalue indicative of a size of the block (k, which is calculated based onn, which is log₂(TUBlkSize)−2). In this example, video encoder 20 and/orvideo decoder 30 may also execute example function (9) to produce thecontext index based on an offset value that is determined based onwhether the block is a chroma block or a luma block, e.g., as shown infunctions (10) and (11).

As another example, video encoder 20 may implement a step function toderive the context index of the context to be used to entropy code thei^(th) bin. More specifically, the step function may represent afunction that has two or more parts depending on, e.g., the value of thebin index i. Thus, video encoder 20 and/or video decoder 30 may dividethe bins in the last position value into different subsets, e.g.,Subset0, Subset1, etc. Additionally, video encoder 20 and/or videodecoder 30 may apply different functions for different subsets, e.g.,F0( ) for Subset0, F1( ) for Subset1, and so on. For instance, such afunction may be as follows:

$\begin{matrix}{{f\left( {i,{TublkSize}} \right)} = \left\{ {\begin{matrix}{{i = {last\_ bin}},} & 10 \\{else} & {\left( {i\operatorname{>>}1} \right) + {TUSIZEOffset}}\end{matrix},{{{where}{TUSIZEoffset}} = {\left( {{\log_{2}({TUBlkSize})} - 2} \right)*{\left( {{\log_{2}({TUBlkSize})} - 1} \right)/2.}}}} \right.} & (12)\end{matrix}$

In some implementations, the subsets may be pre-defined, and thedefinition of the subsets may be accessible to both video encoder 20 andvideo decoder 30. Alternatively, video encoder 20 (or a user of sourcedevice 12) may select the subsets, and output interface 22 may transmitthe selected subsets to the video decoder 30 of destination device 14using one or more high-level syntax signaling techniques, such as anSPS, a PPS, an APS, a frame header, a slice header, a sequence header,or other such syntax signaling. The definition of the subsets may alsodepend on various other types of information, such as the block size(e.g., the TU size), the residual quadtree (RQT) depth corresponding tothe block, whether the block corresponds to a luminance component or achrominance component, the frame size for the frame including the block(e.g., in pixel resolution), the motion compensation block size for amotion compensation block (e.g., a prediction unit (PU)) correspondingto the block, the frame-type (I/P/B) for the frame including the block,the inter-prediction direction for the corresponding motion compensationblock, the motion vector amplitude for the corresponding motioncompensation block, and/or a motion vector difference amplitude for themotion vector of the corresponding motion compensation block.

TABLE 10 Bin index 0 1 2 3 4 5 6 7 8 9 TU 4 × 4 0 0 10 TU 8 × 8 1 1 2 210 TU 16 × 16 3 3 4 4 5 5 10 TU 32 × 32 6 6 7 7 8 8 9 9 10

Example functions (1)-(12) described above may depend, at least in part,on one or more elements of side information. As one example, thefunctions may accept the side information as arguments. In otherexamples, video encoder 20 and/or video decoder 30 may select differentfunctions based on the corresponding side information. The sideinformation may include any or all of the block size (e.g., the TUsize), the residual quadtree depth (RQT) depth corresponding to theblock, whether the block corresponds to a luminance component or achrominance component, the frame size for the frame including the block(e.g., in pixel resolution), the motion compensation block size for amotion compensation block (e.g., a prediction unit (PU)) correspondingto the block, the frame-type (I/P/B) for the frame including the block,the inter-prediction direction for the corresponding motion compensationblock, the motion vector amplitude for the corresponding motioncompensation block, and/or a motion vector difference amplitude for themotion vector of the corresponding motion compensation block. As oneexample, video encoder 20 and/or video decoder 30 may select differentfunctions to derive contexts to apply when coding bins of a valueindicating a last significant coefficient position of a luminance block,vis-à-vis a chrominance block.

Video encoder 20 may further send syntax data, such as block-basedsyntax data, frame-based syntax data, and GOP-based syntax data, tovideo decoder 30, e.g., in a frame header, a block header, a sliceheader, or a GOP header. The GOP syntax data may describe a number offrames in the respective GOP, and the frame syntax data may indicate anencoding/prediction mode used to encode the corresponding frame.

Video encoder 20 and video decoder 30 each may be implemented as any ofa variety of suitable encoder or decoder circuitry, as applicable, suchas one or more microprocessors, digital signal processors (DSPs),application specific integrated circuits (ASICs), field programmablegate arrays (FPGAs), discrete logic circuitry, software, hardware,firmware or any combinations thereof. Each of video encoder 20 and videodecoder 30 may be included in one or more encoders or decoders, eitherof which may be integrated as part of a combined video encoder/decoder(CODEC). A device including video encoder 20 and/or video decoder 30 maycomprise an integrated circuit, a microprocessor, and/or a wirelesscommunication device, such as a cellular telephone.

In this manner, video encoder 20 and video decoder 30 represent examplesof a video coder configured to determine a context for entropy coding abin of a value indicative of a last significant coefficient of a blockof video data using a function of an index of the bin, and code the binusing the determined context.

FIG. 2 is a block diagram illustrating an example of video encoder 20that may implement techniques for determining a context to use to code avalue representing a last significant coefficient of a block of videodata. Video encoder 20 may perform intra- and inter-coding of videoblocks within video slices. Intra-coding relies on spatial prediction toreduce or remove spatial redundancy in video within a given video frameor picture. Inter-coding relies on temporal prediction to reduce orremove temporal redundancy in video within adjacent frames or picturesof a video sequence. Intra-mode (I mode) may refer to any of severalspatial based coding modes. Inter-modes, such as uni-directionalprediction (P mode) or bi-prediction (B mode), may refer to any ofseveral temporal-based coding modes.

As shown in FIG. 2, video encoder 20 receives a current video blockwithin a video frame to be encoded. In the example of FIG. 2, videoencoder 20 includes mode select unit 40, reference frame memory 64,summer 50, transform processing unit 52, quantization unit 54, andentropy encoding unit 56. Mode select unit 40, in turn, includes motioncompensation unit 44, motion estimation unit 42, intra-prediction unit46, and partition unit 48. For video block reconstruction, video encoder20 also includes inverse quantization unit 58, inverse transform unit60, and summer 62. A deblocking filter (not shown in FIG. 2) may also beincluded to filter block boundaries to remove blockiness artifacts fromreconstructed video. If desired, the deblocking filter would typicallyfilter the output of summer 62. Additional filters (in loop or postloop) may also be used in addition to the deblocking filter. Suchfilters are not shown for brevity, but if desired, may filter the outputof summer 50 (as an in-loop filter).

During the encoding process, video encoder 20 receives a video frame orslice to be coded. The frame or slice may be divided into multiple videoblocks. Motion estimation unit 42 and motion compensation unit 44perform inter-predictive coding of the received video block relative toone or more blocks in one or more reference frames to provide temporalprediction. Intra-prediction unit 46 may alternatively performintra-predictive coding of the received video block relative to one ormore neighboring blocks in the same frame or slice as the block to becoded to provide spatial prediction. Video encoder 20 may performmultiple coding passes, e.g., to select an appropriate coding mode foreach block of video data.

Moreover, partition unit 48 may partition blocks of video data intosub-blocks, based on evaluation of previous partitioning schemes inprevious coding passes. For example, partition unit 48 may initiallypartition a frame or slice into LCUs, and partition each of the LCUsinto sub-CUs based on rate-distortion analysis (e.g., rate-distortionoptimization). Mode select unit 40 may further produce a quadtree datastructure indicative of partitioning of an LCU into sub-CUs. Leaf-nodeCUs of the quadtree may include one or more PUs and one or more TUs.

Mode select unit 40 may select one of the coding modes, intra or inter,e.g., based on error results, and provides the resulting intra- orinter-coded block to summer 50 to generate residual block data and tosummer 62 to reconstruct the encoded block for use as a reference frame.Mode select unit 40 also provides syntax elements, such as motionvectors, intra-mode indicators, partition information, and other suchsyntax information, to entropy encoding unit 56.

Motion estimation unit 42 and motion compensation unit 44 may be highlyintegrated, but are illustrated separately for conceptual purposes.Motion estimation, performed by motion estimation unit 42, is theprocess of generating motion vectors, which estimate motion for videoblocks. A motion vector, for example, may indicate the displacement of aPU of a video block within a current video frame or picture relative toa predictive block within a reference frame (or other coded unit)relative to the current block being coded within the current frame (orother coded unit). A predictive block is a block that is found toclosely match the block to be coded, in terms of pixel difference, whichmay be determined by sum of absolute difference (SAD), sum of squaredifference (SSD), or other difference metrics. In some examples, videoencoder 20 may calculate values for sub-integer pixel positions ofreference pictures stored in reference frame memory 64. For example,video encoder 20 may interpolate values of one-quarter pixel positions,one-eighth pixel positions, or other fractional pixel positions of thereference picture. Therefore, motion estimation unit 42 may perform amotion search relative to the full pixel positions and fractional pixelpositions and output a motion vector with fractional pixel precision.

Motion estimation unit 42 calculates a motion vector for a PU of a videoblock in an inter-coded slice by comparing the position of the PU to theposition of a predictive block of a reference picture. The referencepicture may be selected from a first reference picture list (List 0) ora second reference picture list (List 1), each of which identify one ormore reference pictures stored in reference frame memory 64. Motionestimation unit 42 sends the calculated motion vector to entropyencoding unit 56 and motion compensation unit 44.

Motion compensation, performed by motion compensation unit 44, mayinvolve fetching or generating the predictive block based on the motionvector determined by motion estimation unit 42. Again, motion estimationunit 42 and motion compensation unit 44 may be functionally integrated,in some examples. Upon receiving the motion vector for the PU of thecurrent video block, motion compensation unit 44 may locate thepredictive block to which the motion vector points in one of thereference picture lists. Summer 50 forms a residual video block bysubtracting pixel values of the predictive block from the pixel valuesof the current video block being coded, forming pixel difference values,as discussed below. In general, motion estimation unit 42 performsmotion estimation relative to luma components, and motion compensationunit 44 uses motion vectors calculated based on the luma components forboth chroma components and luma components. Mode select unit 40 may alsogenerate syntax elements associated with the video blocks and the videoslice for use by video decoder 30 in decoding the video blocks of thevideo slice.

Intra-prediction unit 46 may intra-predict a current block, as analternative to the inter-prediction performed by motion estimation unit42 and motion compensation unit 44, as described above. In particular,intra-prediction unit 46 may determine an intra-prediction mode to useto encode a current block. In some examples, intra-prediction unit 46may encode a current block using various intra-prediction modes, e.g.,during separate encoding passes, and intra-prediction unit 46 (or modeselect unit 40, in some examples) may select an appropriateintra-prediction mode to use from the tested modes.

For example, intra-prediction unit 46 may calculate rate-distortionvalues using a rate-distortion analysis for the various testedintra-prediction modes, and select the intra-prediction mode having thebest rate-distortion characteristics among the tested modes.Rate-distortion analysis generally determines an amount of distortion(or error) between an encoded block and an original, unencoded blockthat was encoded to produce the encoded block, as well as a bitrate(that is, a number of bits) used to produce the encoded block.Intra-prediction unit 46 may calculate ratios from the distortions andrates for the various encoded blocks to determine which intra-predictionmode exhibits the best rate-distortion value for the block.

After selecting an intra-prediction mode for a block, intra-predictionunit 46 may provide information indicative of the selectedintra-prediction mode for the block to entropy encoding unit 56. Entropyencoding unit 56 may encode the information indicating the selectedintra-prediction mode. Video encoder 20 may include in the transmittedbitstream configuration data, which may include a plurality ofintra-prediction mode index tables and a plurality of modifiedintra-prediction mode index tables (also referred to as codeword mappingtables), definitions of encoding contexts for various blocks, andindications of a most probable intra-prediction mode, anintra-prediction mode index table, and a modified intra-prediction modeindex table to use for each of the contexts.

Video encoder 20 forms a residual video block by subtracting theprediction data from mode select unit 40 from the original video blockbeing coded. Summer 50 represents the component or components thatperform this subtraction operation. Transform processing unit 52 appliesa transform, such as a discrete cosine transform (DCT) or a conceptuallysimilar transform, to the residual block, producing a video blockcomprising residual transform coefficient values. Transform processingunit 52 may perform other transforms which are conceptually similar toDCT. Wavelet transforms, integer transforms, sub-band transforms orother types of transforms could also be used. In any case, transformprocessing unit 52 applies the transform to the residual block,producing a block of residual transform coefficients. The transform mayconvert the residual information from a pixel value domain to atransform domain, such as a frequency domain. Transform processing unit52 may send the resulting transform coefficients to quantization unit54. Quantization unit 54 quantizes the transform coefficients to furtherreduce bit rate. The quantization process may reduce the bit depthassociated with some or all of the coefficients. The degree ofquantization may be modified by adjusting a quantization parameter. Insome examples, quantization unit 54 may then perform a scan of thematrix including the quantized transform coefficients. Alternatively,entropy encoding unit 56 may perform the scan.

Following quantization, entropy encoding unit 56 entropy codes thequantized transform coefficients. For example, entropy encoding unit 56may perform context adaptive variable length coding (CAVLC), contextadaptive binary arithmetic coding (CABAC), syntax-based context-adaptivebinary arithmetic coding (SBAC), probability interval partitioningentropy (PIPE) coding or another entropy coding technique. In the caseof context-based entropy coding, context may be based on neighboringblocks. Following the entropy coding by entropy encoding unit 56, theencoded bitstream may be transmitted to another device (e.g., videodecoder 30) or archived for later transmission or retrieval.

In particular, entropy encoding unit 56 may receive, from quantizationunit 54, a set of quantized transform coefficients associated with a TU.In turn, entropy encoding unit 56 may scan the set of quantizedtransform coefficients, and determine whether each scanned coefficientincludes a significant coefficient, i.e., whether the coefficient has azero or non-zero value. A non-zero value may indicate that a particularquantized transform coefficient is a “significant” coefficient. Ininstances where entropy encoding unit 56 detects a significantcoefficient, entropy encoding unit 56 may code data representative ofthe particular value associated with the coefficient (e.g., one, two,and so on). Such data may include, for example, an indication of thesign of the coefficient, whether the absolute value of the coefficientis greater than one, and when the absolute value of the coefficient isgreater than one, whether the absolute value of the coefficient isgreater than two. Additionally, in instances where a significantcoefficient has an absolute value greater than two, entropy encodingunit 56 may subtract two from the absolute value of the coefficient,thereby obtaining a value by which the coefficient exceeds two, and codethis value.

By scanning the entire set of quantized transform coefficients receivedfrom quantization unit 54, entropy encoding unit 56 may also detect andidentify the last significant coefficient associated with a particularTU (i.e., in scan order). Additionally, entropy encoding unit 56 maydetermine the position of the last significant coefficient within thecorresponding TU. For instance, entropy encoding unit 56 may identifyhorizontal and vertical (x- and y-) coordinates of the last significantcoefficient within the TU.

Moreover, entropy encoding unit 56 may be configured to binarize syntaxelements that do not already have a binary value. That is, entropyencoding unit 56 may determine a binary string representative of thevalue of a syntax element when the syntax element is not alreadyrepresented by a binary string. A binary string, or binarized value,generally corresponds to an array of bits, each of which may have avalue of “0” or “1.” The array may be zero-indexed, such that theordinal first bit of the array occurs at position 0, the ordinal secondbit of the array occurs at position 1, and so on. Thus, entropy encodingunit 56 may form a binarized value B[N] having a length of N bits, eachbit occurring at a respective position B[i], where 0≦i≦N−1.

In turn, entropy encoding unit 56 may entropy encode data representingthe x- and y-coordinates of the last significant coefficient. Forexample, entropy encoding unit 56 may be configured to entropy encodethe syntax elements last_significant_coeff_x_prefix,last_significant_coeff_y_prefix, last_significant_coeff_x_suffix, and/orlast_significant_coeff_y_suffix, which together, in HEVC, represent thex- and y-coordinates of the last significant coefficient in scan order.Entropy encoding unit 56 may implement one or more techniques of thisdisclosure to entropy encode data representing the coordinates of thelast significant coefficient using a function, denoted by f(i). Forexample, entropy encoding unit 56 may entropy encode various syntaxelements, such as syntax elements for the quantized transformcoefficients received from quantization unit 54 and/or valuesrepresenting a last significant coefficient of a TU (e.g., the syntaxelements described above), using contexts determined using one or morefunctions of bins of a value representative of the corresponding syntaxelement.

For instance, “Ctx_i” may denote the index of the context used byentropy encoding unit 56 to encode the i^(th) bin in a binarized valuerepresenting the position of the last significant coefficient, asdescribed above with respect to Tables 1-2 and 8-9. The context indexedby ctx_i generally indicates a most probable symbol (e.g., “1” or “0,”)as well as the probability of the most probable symbol. Entropy encodingunit 56 may derive the value of Ctx_i using the equation Ctx_i=f(i),where f(i) may be a predefined function accessible to entropy encodingunit 56, or a function selected by a user. Additionally, entropyencoding unit 56 may encode data representative of f(i), so that videodecoder 30 may decode the data for the function f(i) and use f(i) toobtain the value of Ctx_i. In this manner, entropy encoding unit 56 candetermine the context for a particular bin of a binarized syntax elementusing a function of the bin index, that is, the position of the bin in abinarized value (i.e., a binary string) representing the syntax element.

In some examples, entropy encoding unit 56 is configured to determinecontexts for coding bins of data representing the last significantcoefficient position using formulas (5)-(8) described above. That is,entropy encoding unit 56 may calculate f(i) as follows:Ctx_idx=offset+(i>>k). Moreover, entropy encoding unit 56 may derive thevalues of the offset value and k used in f(i) using the followingequations:offset=3*n+((n+1)>>2),k=(n+3)>>2, andn=(log₂(block_size)−2).

In other implementations, entropy encoding unit 56 may use one or moreof example functions (1)-(4) and (9)-(12), in addition or in thealternative to formulas (5)-(8), when determining a context for entropyencoding a bin of data representing the position of the last significantcoefficient of a TU. In this manner, video encoder 20 and componentsthereof, such as entropy encoding unit 56, may implement the techniquesof this disclosure to encode data representative of the last significantcoefficient using one or more functions. Such functions can be storedmore efficiently in memory of video encoder 20 and video decoder 30 thantables. Therefore, the techniques of this disclosure may provide forvideo encoders and video decoders that utilize memory more efficiently,e.g., by allocating memory that would otherwise be devoted to a table toother data, or by decreasing the required amount of memory for a videoencoder or video decoder.

Inverse quantization unit 58 and inverse transform unit 60 apply inversequantization and inverse transformation, respectively, to reconstructthe residual block in the pixel domain, e.g., for later use as areference block. Motion compensation unit 44 may calculate a referenceblock by adding the residual block to a predictive block of one of theframes of reference frame memory 64. Motion compensation unit 44 mayalso apply one or more interpolation filters to the reconstructedresidual block to calculate sub-integer pixel values for use in motionestimation. Summer 62 adds the reconstructed residual block to themotion compensated prediction block produced by motion compensation unit44 to produce a reconstructed video block for storage in reference framememory 64. The reconstructed video block may be used by motionestimation unit 42 and motion compensation unit 44 as a reference blockto inter-code a block in a subsequent video frame.

In this manner, video encoder 20 of FIG. 2 represents an example of avideo encoder configured to determine a context for entropy coding a binof a value indicative of a last significant coefficient of a block ofvideo data using a function of an index of the bin, and code the binusing the determined context. Moreover, video encoder 20 also representsan example of a video encoder in which the function produces a contextindex for the context by right-shifting the index of the bin by a valuek and adding the right-shifted value to an offset value, wherein theoffset value is determined according to the formulaoffset=3*n+((n+1)>>2), wherein the value k is determined according tothe formula k=(n+3)>>2, and wherein the value n is determined accordingto the formula n=(log₂(block_size)−2).

FIG. 3 is a block diagram illustrating an example of video decoder 30that may implement techniques for determining a context to use to code avalue representing a last significant coefficient of a block of videodata. In the example of FIG. 3, video decoder 30 includes an entropydecoding unit 70, motion compensation unit 72, intra prediction unit 74,inverse quantization unit 76, inverse transformation unit 78, referenceframe memory 82 and summer 80. Video decoder 30 may, in some examples,perform a decoding pass generally reciprocal to the encoding passdescribed with respect to video encoder 20 (FIG. 2). Motion compensationunit 72 may generate prediction data based on motion vectors receivedfrom entropy decoding unit 70, while intra-prediction unit 74 maygenerate prediction data based on intra-prediction mode indicatorsreceived from entropy decoding unit 70.

During the decoding process, video decoder 30 receives an encoded videobitstream that represents video blocks of an encoded video slice andassociated syntax elements from video encoder 20. Entropy decoding unit70 of video decoder 30 entropy decodes the bitstream to generatequantized coefficients, motion vectors or intra-prediction modeindicators, and other syntax elements. Entropy decoding unit 70 forwardsthe motion vectors to and other syntax elements to motion compensationunit 72. Video decoder 30 may receive the syntax elements at the videoslice level and/or the video block level.

Entropy decoding unit 70 may generate a block (e.g., a TU) of quantizedcoefficients by entropy decoding the encoded video bitstream, andpopulating entropy decoded quantized coefficients in the block in scanorder. For instance, entropy decoding unit 70 may entropy decode syntaxelements of the encoded video bitstream to determine locations ofsignificant coefficients in the block to be generated. If a location ofthe block corresponds to a coefficient that is not a significantcoefficient, entropy decoding unit 70 may set the value of thecoefficient at that location in the block to zero. On the other hand, ifentropy decoding unit 70 determines that a particular quantizedcoefficient is a significant coefficient, entropy decoding unit 70 mayset the value of the significant coefficient based on data provided inthe encoded video bitstream by video encoder 20.

Moreover, as explained below, entropy decoding unit 70 may determine theposition of a last significant coefficient in the block based on syntaxelements indicating the x- and y-coordinates of the last significantcoefficient. In accordance with the techniques of this disclosure, asexplained in greater detail below, entropy decoding unit 70 may use afunction to determine context for entropy decoding bins of valuesrepresenting the x- and y-coordinates of the last significantcoefficient. Video decoder 30 may use the indication of the position ofthe last significant coefficient to determine when data of the bitstreamrepresents subsequent syntax elements, that is, syntax elements that donot represent data of the block being regenerated.

Entropy decoding unit 70 may determine, based on data provided in theencoded video bitstream, a sign for each significant coefficient, anddata representing the level value of each significant coefficient. Forexample, entropy decoding unit 70 may determine a sign for a significantcoefficient through entropy decoding a syntax element representing thesign, e.g., coeff_sign_flag. In addition, entropy decoding unit 70 maydecode one or more syntax elements representative of the level value ofeach significant coefficient, e.g., coeff_abs_level_greater1_flag,coeff_abs_level_greater2_flag, and coeff_abs_level_remaining. Ingeneral, coeff_abs_level_greater1_flag indicates whether the absolutevalue of a significant coefficient is greater than 1,coeff_abs_level_greater2_flag indicates whether the absolute value of asignificant coefficient is greater than 2, and coeff_abs_level_remainingindicates the absolute value of a significant coefficient minus 2.

Entropy decoding unit 70 may also determine the position of the lastsignificant coefficient of the block (e.g., the TU) being regenerated.More specifically, entropy decoding unit 70 may identify the position(e.g., based on coded syntax elements representative of x- andy-coordinates) of the last significant coefficient within the TUassociated with the encoded video bitstream. Based on identifying theposition of the last significant coefficient, entropy decoding unit 70may set the values of remaining coefficients in the TU in scan order tozero. That is, video decoder 30 need not receive any syntax elements forcoefficients beyond the last significant coefficient, and further, mayinfer values of 0 for these coefficients.

Additionally, entropy decoding unit 70 may implement one or moretechniques of this disclosure to decode bins of a binarized valuerepresenting the x- and y-coordinates of the position of the lastsignificant coefficient using a function, generally denoted by f(i),where i corresponds to the position of the bin in the binarized value.In some examples, entropy decoding unit 70 may decode encoded data usinga determined context to reproduce a value for the bin, e.g., “0” or “1.”Although described as corresponding to the last significant coefficientposition, the techniques of this disclosure can be applied to entropydecoding other syntax elements as well. For example, entropy decodingunit 70 may entropy decode various syntax elements, such as syntaxelements for the quantized coefficients sent to one or both of motioncompensation unit 72 and intra prediction unit 74, syntax elementsrepresentative of quantized transform coefficients, and/or valuesrepresenting a last significant coefficient of the TU associated withthe encoded video bitstream, using contexts determined using one or morefunctions of bin indexes of a value representative of the correspondingsyntax element.

For instance, “Ctx_i” may denote the index of the context used byentropy decoding unit 70 to decode the i^(th) bin in a binarized valuerepresenting the position of the last significant coefficient, asdescribed above with respect to Tables 1-2 and 8-9. In this example,entropy decoding unit 70 may derive the value of Ctx_i using theequation Ctx_i=f(i), where f(i) may be a predefined function accessibleto entropy decoding unit 70 (e.g., communicated by source device 12), ora function selected by a user. Additionally, entropy decoding unit 70may decode data representative of f(i), so as to use the datarepresentative of f(i) to obtain the value of Ctx_i.

In some examples, entropy decoding unit 70 is configured to determinecontexts for decoding bins of data representing the last significantcoefficient position using formulas (5)-(8) described above. That is,entropy decoding unit 70 may calculate f(i) as follows:Ctx_idx=offset+(i>>k). Moreover, entropy decoding unit 70 may derive thevalues of the offset value and k used in f(i) using the followingequations:offset=3*n+((n+1)>>2),k=(n+3)>>2, andn=(log₂(block_size)−2).

In other implementations, entropy decoding unit 70 may set f(i) to oneor more of example equations (1)-(4) and (9)-(12) in decoding the lastsignificant coefficient of a TU represented by the encoded videobitstream. In this manner, video decoder 30 and components thereof, suchas entropy decoding unit 70, may implement the techniques of thisdisclosure to decode the last significant coefficient using one or morefunctions. Such functions can be stored more efficiently in memory ofvideo encoder 20 and video decoder 30 than tables. Therefore, thetechniques of this disclosure may provide for video encoders and videodecoders that utilize memory more efficiently, e.g., by allocatingmemory that would otherwise be devoted to a table to other data, or bydecreasing the required amount of memory for a video encoder or videodecoder.

When the video slice is coded as an intra-coded (I) slice, intraprediction unit 74 may generate prediction data for a video block of thecurrent video slice based on a signaled intra prediction mode and datafrom previously decoded blocks of the current frame or picture. When thevideo frame is coded as an inter-coded (i.e., B, P or GPB) slice, motioncompensation unit 72 produces predictive blocks for a video block of thecurrent video slice based on the motion vectors and other syntaxelements received from entropy decoding unit 70. The predictive blocksmay be produced from one of the reference pictures within one of thereference picture lists. Video decoder 30 may construct the referenceframe lists, List 0 and List 1, using default construction techniquesbased on reference pictures stored in reference frame memory 82.

Motion compensation unit 72 determines prediction information for avideo block of the current video slice by parsing the motion vectors andother syntax elements, and uses the prediction information to producethe predictive blocks for the current video block being decoded. Forexample, motion compensation unit 72 uses some of the received syntaxelements to determine a prediction mode (e.g., intra- orinter-prediction) used to code the video blocks of the video slice, aninter-prediction slice type (e.g., B slice, P slice, or GPB slice),construction information for one or more of the reference picture listsfor the slice, motion vectors for each inter-encoded video block of theslice, inter-prediction status for each inter-coded video block of theslice, and other information to decode the video blocks in the currentvideo slice.

Motion compensation unit 72 may also perform interpolation based oninterpolation filters. Motion compensation unit 72 may use interpolationfilters as used by video encoder 20 during encoding of the video blocksto calculate interpolated values for sub-integer pixels of referenceblocks. In this case, motion compensation unit 72 may determine theinterpolation filters used by video encoder 20 from the received syntaxelements and use the interpolation filters to produce predictive blocks.

Inverse quantization unit 76 inverse quantizes, i.e., de-quantizes, thequantized transform coefficients provided in the bitstream and decodedby entropy decoding unit 70. The inverse quantization process mayinclude use of a quantization parameter QP_(Y) calculated by videodecoder 30 for each video block in the video slice to determine a degreeof quantization and, likewise, a degree of inverse quantization thatshould be applied.

Inverse transform unit 78 applies an inverse transform, e.g., an inverseDCT, an inverse integer transform, or a conceptually similar inversetransform process, to the transform coefficients in order to produceresidual blocks in the pixel domain.

After motion compensation unit 72 generates the predictive block for thecurrent video block based on the motion vectors and other syntaxelements, video decoder 30 forms a decoded video block by summing theresidual blocks from inverse transform unit 78 with the correspondingpredictive blocks generated by motion compensation unit 72. Summer 80represents the component or components that perform this summationoperation. If desired, a deblocking filter may also be applied to filterthe decoded blocks in order to remove blockiness artifacts. Other loopfilters (either in the coding loop or after the coding loop) may also beused to smooth pixel transitions, or otherwise improve the videoquality. The decoded video blocks in a given frame or picture are thenstored in reference frame memory 82, which stores reference picturesused for subsequent motion compensation. Reference frame memory 82 alsostores decoded video for later presentation on a display device, such asdisplay device 32 of FIG. 1.

In this manner, video decoder 30 of FIG. 3 represents an example of avideo decoder configured to determine a context for entropy coding a binof a value indicative of a last significant coefficient of a block ofvideo data using a function of an index of the bin, and code the binusing the determined context. Moreover, video decoder 30 also representsan example of a video decoder in which the function produces a contextindex for the context by right-shifting the index of the bin by a valuek and adding the right-shifted value to an offset value, wherein theoffset value is determined according to the formulaoffset=3*n+((n+1)>>2), wherein the value k is determined according tothe formula k=(n+3)>>2, and wherein the value n is determined accordingto the formula n=(log2(block_size)−2).

FIG. 4 is a flowchart illustrating an example method for encoding acurrent block. The current block may comprise a current CU or a portionof the current CU. Although described with respect to video encoder 20(FIGS. 1 and 2), it should be understood that other devices may beconfigured to perform a method similar to that of FIG. 4. Moreover,although the example method of FIG. 4 specifically describes codingsyntax elements relating to the position of the last significantcoefficient of a video block using these techniques, it should beunderstood that these techniques may be applied to coding other syntaxelements as well.

In this example, video encoder 20 initially predicts the current block(150). For example, video encoder 20 may calculate one or moreprediction units (PUs) for the current block. Video encoder 20 may thencalculate a residual block for the current block, e.g., to produce atransform unit (TU) (152). To calculate the residual block, videoencoder 20 may calculate a difference between the original, uncodedblock and the predicted block for the current block. Video encoder 20may then transform and quantize coefficients of the residual block(154). Next, video encoder 20 may scan the quantized transformcoefficients of the residual block (156). During the scan, or followingthe scan, video encoder 20 may entropy encode the coefficients (158).For example, video encoder 20 may encode the coefficients using CAVLC orCABAC.

Video encoder 20 may also determine a value for a position of a lastsignificant coefficient in the TU (160). The value may comprise, forexample, a binarized value representative of the position of the lastsignificant coefficient, e.g., as described with respect to Table 1above. A maximum number of bins of the value may be coded using CABAC,while other bins exceeding the maximum number may be bypass coded, againas described with respect to Table 1. In particular, in accordance withthe techniques of this disclosure, video encoder 20 may determinecontexts for bins of the value using a function (162). As explainedabove, the contexts may describe probabilities of the bins having aparticular value, e.g., “0” or “1.” The function may correspond to oneof functions (1)-(12) described above, or a conceptually similarfunction.

With respect to the examples of functions (5)-(8), video encoder 20 maydetermine a context, ctx_idx, for a bin at position i of a binarizedvalue representative of a position of a last significant coefficient,using the formula offset+(i>>k), where offset=3*n+((n+1)>>2),k=(n+3)>>2, and n=(log₂(block_size)−2). That is, video encoder 20 mayiterate through each bin to be entropy encoded and execute the functionsshown above to determine a context for coding a bin of the currentiteration. Video encoder 20 may then encode the bins of the value (e.g.,the bins not in excess of the maximum number of bins) using thedetermined contexts (164). Likewise, video encoder 20 may bypass codeany remaining bins of the value (166).

In this manner, the method of FIG. 4 represents an example of a methodincluding determining a context for entropy coding a bin of a valueindicative of a last significant coefficient of a block of video datausing a function of an index of the bin, and coding the bin using thedetermined context. Moreover, the function may produce a context indexfor the context by right-shifting the index of the bin by a value k andadding the right-shifted value to an offset value, wherein the offsetvalue is determined according to the formula offset=3*n+((n+1)>>2),wherein the value k is determined according to the formula k=(n+3)>>2,and wherein the value n is determined according to the formulan=(log₂(block_size)−2).

FIG. 5 is a flowchart illustrating an example method for decoding acurrent block of video data. The current block may comprise a current CUor a portion of the current CU. Although described with respect to videodecoder 30 (FIGS. 1 and 3), it should be understood that other devicesmay be configured to perform a method similar to that of FIG. 5.Moreover, although the example method of FIG. 4 specifically describescoding syntax elements relating to the position of the last significantcoefficient of a video block using these techniques, it should beunderstood that these techniques may be applied to coding other syntaxelements as well.

Video decoder 30 may predict the current block (200), e.g., using anintra- or inter-prediction mode to calculate a predicted block for thecurrent block. Video decoder 30 may also receive entropy coded data forthe current block, such as entropy coded data for coefficients of aresidual block corresponding to the current block (202). Video decoder30 may entropy decode the entropy coded data to reproduce coefficientsof the residual block (204).

In accordance with the techniques of this disclosure, video decoder 30may receive an encoded value indicative of a position of a lastsignificant coefficient in the TU (206). A maximum number of bins of thevalue may be decoded using CABAC, while other bins exceeding the maximumnumber may be bypass decoded, as described with respect to Table 1. Inparticular, in accordance with the techniques of this disclosure, videodecoder 30 may determine contexts for bins of the value using a function(208). As explained above, the contexts may describe probabilities ofthe bins having a particular value, e.g., “0” or “1.” The function maycorrespond to one of functions (1)-(12) described above, or aconceptually similar function.

With respect to the examples of functions (5)-(8), video decoder 30 maydetermine a context, ctx_idx, for a bin at position i of a binarizedvalue being decoded, where the binarized value is representative of aposition of a last significant coefficient, using the formulaoffset+(i>>k), where offset=3*n+((n+1)>>2), k=(n+3)>>2, andn=(log₂(block_size)−2). That is, video decoder 30 may iteratively decodeeach bin to be entropy decoded and execute the functions shown above todetermine a context for coding a bin of the current iteration. Videodecoder 30 may then decode the bins of the value (e.g., the bins not inexcess of the maximum number of bins) using the determined contexts(210). For instance, video decoder 30 may decode encoded data receivedfrom video encoder 20 using the determined contexts to reproduce orotherwise obtain the bins of the value. Likewise, video decoder 30 maybypass decode any remaining bins of the value (212).

Video decoder 30 may then inverse scan the reproduced coefficients basedon the position of the last significant coefficient (214), to create ablock of quantized transform coefficients. That is, video decoder 30 mayplace the decoded coefficients in the TU, starting at the position ofthe last significant coefficient, and proceeding in a scan order thatgenerally corresponds to the scan order used by the encoder. Videodecoder 30 may then inverse quantize and inverse transform thecoefficients to produce a residual block (216). Video decoder 30 mayultimately decode the current block by combining the predicted block andthe residual block (218).

In this manner, the method of FIG. 5 represents an example of a methodincluding determining a context for entropy coding a bin of a valueindicative of a last significant coefficient of a block of video datausing a function of an index of the bin, and coding the bin using thedetermined context. Moreover, the function may produce a context indexfor the context by right-shifting the index of the bin by a value k andadding the right-shifted value to an offset value, wherein the offsetvalue is determined according to the formula offset=3*n+((n+1)>>2),wherein the value k is determined according to the formula k=(n+3)>>2,and wherein the value n is determined according to the formulan=(log₂(block_size)−2).

It is to be recognized that depending on the example, certain acts orevents of any of the techniques described herein can be performed in adifferent sequence, may be added, merged, or left out altogether (e.g.,not all described acts or events are necessary for the practice of thetechniques). Moreover, in certain examples, acts or events may beperformed concurrently, e.g., through multi-threaded processing,interrupt processing, or multiple processors, rather than sequentially.

In one or more examples, the functions described may be implemented inhardware, software, firmware, or any combination thereof. If implementedin software, the functions may be stored on or transmitted over as oneor more instructions or code on a computer-readable medium and executedby a hardware-based processing unit. Computer-readable media may includecomputer-readable storage media, which corresponds to a tangible mediumsuch as data storage media, or communication media including any mediumthat facilitates transfer of a computer program from one place toanother, e.g., according to a communication protocol. In this manner,computer-readable media generally may correspond to (1) tangiblecomputer-readable storage media which is non-transitory or (2) acommunication medium such as a signal or carrier wave. Data storagemedia may be any available media that can be accessed by one or morecomputers or one or more processors to retrieve instructions, codeand/or data structures for implementation of the techniques described inthis disclosure. A computer program product may include acomputer-readable medium.

By way of example, and not limitation, such computer-readable storagemedia can comprise RAM, ROM, EEPROM, CD-ROM or other optical diskstorage, magnetic disk storage, or other magnetic storage devices, flashmemory, or any other medium that can be used to store desired programcode in the form of instructions or data structures and that can beaccessed by a computer. Also, any connection is properly termed acomputer-readable medium. For example, if instructions are transmittedfrom a website, server, or other remote source using a coaxial cable,fiber optic cable, twisted pair, digital subscriber line (DSL), orwireless technologies such as infrared, radio, and microwave, then thecoaxial cable, fiber optic cable, twisted pair, DSL, or wirelesstechnologies such as infrared, radio, and microwave are included in thedefinition of medium. It should be understood, however, thatcomputer-readable storage media and data storage media do not includeconnections, carrier waves, signals, or other transitory media, but areinstead directed to non-transitory, tangible storage media. Disk anddisc, as used herein, includes compact disc (CD), laser disc, opticaldisc, digital versatile disc (DVD), floppy disk and Blu-ray disc, wheredisks usually reproduce data magnetically, while discs reproduce dataoptically with lasers. Combinations of the above should also be includedwithin the scope of computer-readable media.

Instructions may be executed by one or more processors, such as one ormore digital signal processors (DSPs), general purpose microprocessors,application specific integrated circuits (ASICs), field programmablelogic arrays (FPGAs), or other equivalent integrated or discrete logiccircuitry. Accordingly, the term “processor,” as used herein may referto any of the foregoing structure or any other structure suitable forimplementation of the techniques described herein. In addition, in someaspects, the functionality described herein may be provided withindedicated hardware and/or software modules configured for encoding anddecoding, or incorporated in a combined codec. Also, the techniquescould be fully implemented in one or more circuits or logic elements.

The techniques of this disclosure may be implemented in a wide varietyof devices or apparatuses, including a wireless handset, an integratedcircuit (IC) or a set of ICs (e.g., a chip set). Various components,modules, or units are described in this disclosure to emphasizefunctional aspects of devices configured to perform the disclosedtechniques, but do not necessarily require realization by differenthardware units. Rather, as described above, various units may becombined in a codec hardware unit or provided by a collection ofinteroperative hardware units, including one or more processors asdescribed above, in conjunction with suitable software and/or firmware.

Various examples have been described. These and other examples arewithin the scope of the following claims.

What is claimed is:
 1. A method of coding video data, the methodcomprising: determining a context for entropy coding a bin of a valueindicative of a last significant coefficient of a block of video datausing a function of an index of the bin, wherein the function produces acontext index for the context by right-shifting the index of the bin bya value k and adding the right-shifted value to an offset value, whereinthe offset value is determined according to the formula:offset=3*n+((n+1)>>2), wherein the value k is determined according tothe formula: k=(n+3)>>2, wherein the value n is determined according tothe formula: n=(log₂(block_size)−2), and wherein the value block_sizecomprises a value indicative of the size of the block; and coding thebin using the determined context.
 2. The method of claim 1, whereindetermining the context comprises executing the function.
 3. The methodof claim 1, wherein the function comprises a linear function.
 4. Themethod of claim 1, wherein the function comprises a non-linear function.5. The method of claim 1, wherein the function produces a context indexfor the context by right-shifting the index of the bin by one.
 6. Themethod of claim 1, further comprising receiving the function from auser.
 7. The method of claim 1, further comprising receiving syntax datadefining the function.
 8. The method of claim 1, wherein coding the bincomprises entropy decoding encoded data using the determined context toreproduce a value for the bin.
 9. The method of claim 1, wherein codingthe bin comprises entropy encoding the bin using the determined context.10. A device for coding video data, the device comprising: a memoryconfigured to store the video data; and one or more processorsconfigured to: determine a context for entropy coding a bin of a valueindicative of a last significant coefficient of a block of video datausing a function of an index of the bin, wherein the function produces acontext index for the context by right-shifting the index of the bin bya value k and adding the right-shifted value to an offset value, whereinthe offset value is determined according to the formula: offset=3*n+((n+1)>>2), wherein the value k is determined according tothe formula:  k=(n+3)>>2, wherein the value n is determined according tothe formula:  n=(log₂(block_size)−2), and wherein the value block_sizecomprises a value indicative of the size of the block; and code the binusing the determined context.
 11. The device of claim 10, wherein thevideo coder is configured to determine the context at least in part byexecuting the function.
 12. The device of claim 10, wherein the videocoder is further configured to receive syntax data defining thefunction.
 13. The device of claim 10, wherein the video coder isconfigured to code the bin at least in part by entropy decoding encodeddata using the determined context to reproduce a value for the bin. 14.The device of claim 10, wherein the video coder is configured to codethe bin at least in part by entropy encoding the bin using thedetermined context.
 15. The device of claim 10, wherein the devicecomprises at least one of: an integrated circuit; a microprocessor; anda wireless communication device that comprises the video coder.
 16. Adevice for coding video data, the device comprising: means fordetermining a context for entropy coding a bin of a value indicative ofa last significant coefficient of a block of video data using a functionof an index of the bin, wherein the function produces a context indexfor the context by right-shifting the index of the bin by a value k andadding the right-shifted value to an offset value, wherein the offsetvalue is determined according to the formula: offset=3*n+((n+1)>>2),wherein the value k is determined according to the formula: k=(n+3)>>2,wherein the value n is determined according to the formula:n=(log₂(block_size)−2), and wherein the value block_size comprises avalue indicative of the size of the block; and means for coding the binusing the determined context.
 17. The device of claim 16, wherein themeans for determining the context comprises means for executing thefunction.
 18. The device of claim 16, further comprising means forreceiving syntax data defining the function.
 19. A computer-readablestorage medium encoded with instructions that, when executed, cause aprogrammable processor of a computing device to: determine a context forentropy coding a bin of a value indicative of a last significantcoefficient of a block of video data using a function of an index of thebin, wherein the function produces a context index for the context byright-shifting the index of the bin by a value k and adding theright-shifted value to an offset value, wherein the offset value isdetermined according to the formula: offset=3*n+((n+1)>>2), wherein thevalue k is determined according to the formula: k=(n+3)>>2, wherein thevalue n is determined according to the formula: n=(log₂(block_size)−2),and wherein the value block_size comprises a value indicative of thesize of the block; and code the bin using the determined context. 20.The computer-readable storage medium of claim 19, wherein theinstructions that cause the programmable processor to determine thecontext further include instructions that cause the programmableprocessor to execute the function.
 21. The computer-readable storagemedium of claim 19, further encoded with instructions that, whenexecuted, cause the programmable processor to receive syntax datadefining the function.